

(function() {
    var D = document.body || document.documentElement,
        w = D.offsetWidth;
    w>1660?doZoom(16):doZoom(14);
})();

var goToTop = {
		addStyle:function(configCss){
			if ((/msie (\d+)/i.test(navigator.userAgent) && !window.opera) ? parseInt(RegExp.jQuery1) : 0) {
				var t = document.createStyleSheet();
				t.cssText = configCss;
			}else{
				var r = document.createElement("style");
				r.setAttribute("type", "text/css");
				document.getElementsByTagName('head')[0].appendChild(r);
				if(r.styleSheet){
					r.styleSheet.cssText = configCss;
				}else{
				r.appendChild(document.createTextNode(configCss));
				}
			}
		},
		createHTML:function(configHTML,configClass,configId){
			if(!this.box){
				this.box = document.createElement("div");
				this.box.innerHTML = configHTML;
				document.body.appendChild(this.box);
				if(configId){this.box.id = configId;};
				if(configClass){this.box.className = configClass;};
			}
			return this;
		},
		goToTop: function(opt) {
		
			var opt = opt || {};
            var botNum = opt.botNum || '15px';
            var gotoHtml = '<a class="backBtn" href="javascript:void(0)"></a>';
            this.createHTML(gotoHtml, "backArea", "HQbackArea");
			this.goBackTop();
            var dLocation = Math.ceil(($(window).width() - 1150) / 2);
            $("#HQbackArea").css({
                bottom: botNum,
                right: dLocation
            });
            _s();
			$(window).scroll(_s);
			function _s() {
				var winScrollTop = $(window).scrollTop();
				if (winScrollTop < 350) $("#HQbackArea").hide();
				else $("#HQbackArea").show();
			}
        },
        goBackTop: function() {
            var gotoCss = "#HQbackArea{position:fixed;display:block;_display:none;}#HQbackArea .backBtn{display:inline-block;width:70px;height:70px;background:url(http://himg2.huanqiu.com/statics/hq2013/images/index/index.png) -80px -747px no-repeat;}#HQbackArea .backBtn:hover{background-position:0 -747px;}";
            this.addStyle(gotoCss);
            $("#HQbackArea .backBtn").click(function(){
                $("html,body").animate({
                    scrollTop: 0
                }, 300);
                return false;
            });
        }
	}
goToTop.goToTop();

var floatAD = {
    init:function(obj,opt) {
        this.opt = {
            w:120,
            h:300,
            minW:1000
        };
        for(var i in opt) {
            this.opt[i] = opt[i];
        }
        this.o = typeof obj=="string"?$("."+obj):obj;
        this.minW = this.opt.minW;
        this.o
        .css({
            width:this.opt.w,
            height:this.opt.h,
            position:"fixed",
            top:150
        });
        this.pos();
        // this.close();
        $(window).on("resize",(function(t) {return function() {t.pos.call(t);};})(this));
    },
    pos:function() {
        this.getW();
        var l = this.W>this.minW+this.opt.w*2?(this.W -  (this.minW + this.opt.w * 2)) / 2:0;
        
        
        this.o.eq(0).css("left",0);
        this.o.eq(1).css("right",0);
        
        /* this.o.each(function() {
            var $o  = $(this),
                v   = $o.html(),
                val = $o.attr("key"), 
                t   = "";
            
            !$("#BAIDU_DUP_wrapper_"+val+"_0").html()&&$o.hide();
            v.replace(/(http:\/\/dup.baidustatic.com\/painter\/)([\w\d]*\/)?([\w\d]+\.js){1}/ig,function(word) {
                
                word.indexOf("floatad")!=-1&&$o.hide();
                
            });
            
        }) */
        
        
    },
    close:function() {
        var $cB = $(document.createElement("div"));
        $cB.css({
            width:"100%",
            height:"20px",
            background:"#999",
            position:"absolute",
            color:"#fff",
            cursor:"pointer",
            "text-align":"center",
            "font-size":"12px",
            "line-height":"20px",
            bottom:0,
            left:0
        })
        .html("关 闭")
        .appendTo(this.o)
        .hover(function() {
            $(this).css("background","#0066cc");
        },function() {
            $(this).css("background","#999");
        })
        .on("click",(function(t) {
            return function() {
                t.o.remove();
            };
        })(this));
    },
    getW:function() {
        this.W = $(document.body).innerWidth();
    }
};

floatAD.init("addl");


$(document).ready(function(e) {
    $('.j-public').each(function(index, element) {
        $(this).find('.js-title li').hover(function(){
            var index=$(this).index();
            $(this).addClass('current').siblings().removeClass('current');
            $(this).parent('.js-title').next('.js-list').find('.js-pronew').eq(index).show().siblings().hide();
        });
    });
    $('.news_list a').each(function(index, element) {
        if((index+1)%2==0){
            $(this).css({'margin-right':'0'});
        }
    });
});

(function() {
	var obj = $("#BAIDU_DUP_wrapper_u1717869_0"),
		posi = null,
		n    = null,
		si   = $(document).scrollTop();
	obj.hide();
	$("#HQbackArea").css("z-index",9999999999);
	$(window).scroll(function() {
		posi&&clearTimeout(posi);
		n = $(document).scrollTop();
		posi = setTimeout(function() {
			n>si?obj.fadeOut(300):(obj.fadeIn(300),$("#HQbackArea").css("z-index",9999999999));
		si = n;
		},100);
	});
})();

(function() {
    _c();
    function _c() {
        var l = $(".conLeft").offset().left+$(".conLeft").width()+10;
        var winScrollTop = $(window).scrollTop();
        if(winScrollTop<312) {
            $(".mak").css({
                left:l,
                top:362,
                zIndex: '100!important',
                position:"absolute"
            });
        }else {
            $(".mak").css({
                left:l,
                top:50,
                zIndex: '100!important',
                position:"fixed"
            });
        }
        
    }
    $(window).scroll(_c);
    $(window).resize(_c);
})();